package net.mihome.app.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Tools {
	public static List<String> listByRes(String resource,String rex){
		System.out.println(resource);
		List<String> list=new ArrayList<String>();
		Pattern pat = Pattern.compile(rex);  
		Matcher mat = pat.matcher(resource);  
		while(mat.find()){
			list.add(mat.group());
		}
		return list;
	}
	public static String getByRex(String resource,String rex){
		List<String> list=listByRes(resource, rex);
		if(list!=null&&!list.isEmpty()){
			return list.get(0);
		}else{
			return null;
		}
	}
}
